package co.baiku.boot.orm.po;

import co.baiku.boot.common.validate.annotation.CheckField;
import co.baiku.boot.core.orm.po.Po;
import com.fasterxml.jackson.annotation.JsonFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Entity
@Table(name = "ajavaer_order")
public class Order extends Po<Long> {
    /**
     * 订单号
     */
    @Column(name = "order_no", columnDefinition = "varchar(255) COMMENT '订单号' ", nullable = false)
    @CheckField(message = "订单号不能为空", notEmpty = true)
    private String orderNo;
    /**
     * 用户id
     */
    @Column(name = "user_id", columnDefinition = "bigint COMMENT '用户id' ", nullable = false)
    @CheckField(message = "用户id不能为空", notEmpty = true)
    private String userId;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "pay_at", columnDefinition = "datetime COMMENT '支付时间' ")
    private LocalDateTime payAt;

    /**
     * 订单金额
     */
    @Column(name = "amount", columnDefinition = "decimal(10,2) COMMENT '订单金额' ")
    private BigDecimal amount;

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public LocalDateTime getPayAt() {
        return payAt;
    }

    public void setPayAt(LocalDateTime payAt) {
        this.payAt = payAt;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }
}
